package com.soft.servlet;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.soft.dao.StudentDao;
import com.soft.entity.Student;


public class StudentViewServlet extends HttpServlet {

	private StudentDao dao=new StudentDao();
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		        String idstr = request.getParameter("id");
		        int id = Integer.parseInt(idstr);
				Student student=dao.queryById(id);
				request.setAttribute("students", student);
				request.getRequestDispatcher("viewstudent.jsp").forward(request, response);	
	}

	
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		this.doGet(request, response);
	}

}
